package com.hsxshop.util;

import com.hsxshop.model.User;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Created by wangchongya on 17/7/3.
 */
public class ParamConvertTool {


    public  static int getParamInt(Map map,String name){
        String val=(null==map.get(name)) ? "0" : map.get(name).toString();
        return Integer.parseInt(val);
    }

    public  static String getParamStr(Map map,String name){

        String val=(null==map.get(name)) ?  "": map.get(name).toString().trim();
        return val;
    }

    public static String getUserPhone(User u){
        String user_phone="";
        String name="".equals(u.getName()) ? u.getNickname() : u.getName();
        if("".equals(name)){
            user_phone=u.getPhone();
        }else{
            user_phone=u.getPhone()+"("+name+")";
        }
        return user_phone;
    }



}
